def sel_sort(arr):
    n = len(arr)

    index = -1
    for i in range(n):
        index = 0
        for j in range(n-i):
            if arr[j]>arr[index]:
                index = j
        arr[n-i-1],arr[index] = arr[index],arr[n-i-1]
        print(arr)
    return arr
list = [34,54,24,14,4,64,87,57,76]

if __name__ == '__main__':
    print(sel_sort(list))
